﻿// Doc-Encode UTF8-BOM, Space(4), Unix(LF)
#include "hiobj.h"
#include "hiobj_in.h"
#include "hiobj_help.h"
#include "himpp_extension.h"
#include "klbutil/CMap.hpp"
#include <assert.h>

#include "hi_comm_sys.h"


// MPP_SYS_CONFIG_S
static int map2obj_MPP_SYS_CONFIG_S(hiobj_t* p_dst, klb::CMap& src)
{
    klb::CMap& r = src;
    MPP_SYS_CONFIG_S* p_cfg = (MPP_SYS_CONFIG_S*)p_dst->data;

    cmap_get_HI_U32(r, "Align", &p_cfg->u32Align);

    return 0;
}

static int obj2map_MPP_SYS_CONFIG_S(klb::CMap& dst, hiobj_t* p_src)
{
    klb::CMap& r = dst;
    const MPP_SYS_CONFIG_S* p_cfg = (const MPP_SYS_CONFIG_S*)p_src->data;

    r["Align"] = (int64_t)p_cfg->u32Align;

    return 0;
}

//////////////////////////////////////////////////////////////////////////


int load_hiobj_sys(himpp_extension_t* p_ex)
{
    static hiobj_reg_t reg[] =
    {
        { "MPP_SYS_CONFIG_S",   sizeof(MPP_SYS_CONFIG_S),   map2obj_MPP_SYS_CONFIG_S ,  obj2map_MPP_SYS_CONFIG_S },

        { NULL, 0,  NULL, NULL }
    };

    himpp_ex_add(p_ex, reg);

    return 1;
}
